import numpy as np
import os
import pathlib

src_data_root = pathlib.Path(r'F:\AIOPS\基于迁移学习的多指标异常检测\code\label-tool-cyp\data\移动_txt')
dst_data_root = pathlib.Path(r'F:\AIOPS\基于迁移学习的多指标异常检测\code\label-tool-cyp\preprocess_data\data')

txt_list = os.listdir(str(src_data_root))
data_list = [None] * 100
for txt_file in txt_list:
    data = np.loadtxt(src_data_root / txt_file, delimiter=',')
    index = int(txt_file.split('_')[0])
    value = np.transpose(data)
    # 归一化
    value = (value - np.min(value)) / (np.max(value) - np.min(value))
    data_list[index] = value

np.save(dst_data_root / 'data.npy', np.array(data_list))